<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('待建档员工列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>登录名称：</label>
                                <input type="text" name="loginName"/>
                            </li>
                            <li>
                                <label>用户昵名称：</label>
                                <input type="text" name="userName"/>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">

            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('erp:profile:edit')}]];
        var removeFlag = [[${@permission.hasPermi('erp:profile:remove')}]];
        var genderDatas = [[${@dict.getType('sys_user_sex')}]];
        var yesNoDatas = [[${@dict.getType('sys_yes_no')}]];
        var educatioinLevelDatas = [[${@dict.getType('education_level')}]];
        var onboardStatusDatas = [[${@dict.getType('onboard_status')}]];
        var prefix = ctx + "erp/profile";

        $(function() {
            var options = {
                url: prefix + "/onboard_list",
                showRefresh: false,
                showColumns: false,
                showToggle: false,
                showSearch: false,
                modalName: "员工档案",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'userId',
                    title: '用户ID'
                },
                {
                    field: 'loginName',
                    title: '登录账号',
                    sortable: true
                },
                {
                    field: 'userName',
                    title: '用户昵称'
                },
                {
                    field: 'dept.deptName',
                    title: '部门'
                },
                {
                    field: 'email',
                    title: '邮箱',
                    visible: false
                },
                {
                    field: 'phonenumber',
                    title: '手机'
                },
                {
                    visible: editFlag == 'hidden' ? false : true,
                    title: '用户状态',
                    align: 'center',
                    formatter: function (value, row, index) {
                        return statusTools(row);
                    }
                },
                {
                    field: 'createTime',
                    title: '创建时间',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        var settingUrl =  "/erp/profile/onboard/" + row.userId;
                        actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.modal.open(\'' + row.userName + '--建立档案\',\''+ settingUrl+ '\',\'700\',\'800\')"><i class="fa fa-address-card"></i>&nbsp;建档</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        /* 用户状态显示 */
        function statusTools(row) {
            if (row.status == 1) {
                return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.userId + '\')"></i> ';
            } else {
                return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.userId + '\')"></i> ';
            }
        }
    </script>
</body>
</html>